package com.idealighter.game.games.fruitslot.struct;

import com.google.common.collect.HashBasedTable;
import com.google.common.collect.Table;

import com.idealighter.game.games.common.AbstractSeat;

import java.util.List;

import lombok.Data;
import lombok.EqualsAndHashCode;


@Data
@EqualsAndHashCode(callSuper = true)
public class FruitslotSeat extends AbstractSeat {

  // 所属桌子
  private final FruitslotTable table;

  // 是否游戏中,点击开始后就是在游戏中
  private boolean gaming = false;
  // 玩家水果拉霸押注的线
  private int line = 0;
  // 当前水果拉霸下注的筹码
  private long bet = 0;
  // 当前结算筹码
  private long billChips = 0;
  // 水果拉霸传图标(3行5列)
  private Table<Integer, Integer, Integer> icons = HashBasedTable.create();
  // bonus游戏次数
  private int bonus = 0;

  // 水果篮倍数
  private List<FruistlotBasket> lotteryRewards;

  /**
   * 构造函数.
   * 
   * @param order 排序.
   * @param table 桌子.
   */
  public FruitslotSeat(byte order, FruitslotTable table) {
    super(order);
    this.table = table;
  }

  /**
   * 重置座位数据.
   */
  public void reset() {
    this.gaming = false;
    // this.line = 0;
    // this.bet = 0;
    this.billChips = 0;
    this.totalChips = 0;
    this.icons.clear();
    this.lotteryRewards = null;
  }

  /**
   * 重置座位数据除了totalChips.
   */
  public void resetButTotalChips() {
    long totalChips = this.totalChips;
    reset();
    this.totalChips = totalChips;
  }

  /**
   * 清空座位数据.
   */
  public void clear() {
    this.playerId = 0;
    this.playerName = null;
    this.bonus = 0;
    this.line = 0;
    this.bet = 0;
    reset();
  }

  @SuppressWarnings("unchecked")
  @Override
  public FruitslotTable table() {
    return table;
  }
}
